package com.szchenya.epermit.domian.base;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * @author lovelyhedong
 * @version 1.0.0
 * @date 2021/12/30
 */
@Data
@ApiModel("分页查询")
public class BaseQueryPage implements Serializable {

    @ApiModelProperty("页数")
    protected Integer page;
    @ApiModelProperty("条数")
    protected Integer size;
    @ApiModelProperty("关键词")
    protected String keyWord;
    @ApiModelProperty("开始时间")
    protected String start;
    @ApiModelProperty("结束时间")
    protected String end;
    @ApiModelProperty(" true 升序  false降序")
    protected Boolean sort;

    public Integer getPage() {
        if (null != page) {
            return page;
        }
        return 1;
    }


    public Integer getSize() {
        if (null != size) {
            return size;
        }
        return 10;
    }

//    public Date getStart() {
//        try{
//            return DateUtil.localDateToDate(LocalDate.parse(start,DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
//        }catch (Exception e){
//            return DateUtil.localDateTimeToDate(LocalDateTime.parse(start,DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
//        }
//    }
//
//
//    public Date getEnd() {
//        try{
//            return DateUtil.localDateToDate(LocalDate.parse(end,DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
//        }catch (Exception e){
//            return DateUtil.localDateTimeToDate(LocalDateTime.parse(end,DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
//        }
//    }


    @Override
    public String toString() {
        return "BasePage{" +
                "page=" + page +
                ", size=" + size +
                ", keyWord='" + keyWord + '\'' +
                ", start=" + start +
                ", end=" + end +
                ", sort=" + sort +
                '}';
    }
}
